-
Notifications
You must be signed in to change notification settings - Fork 54
Make map/array encoding configurable #163
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make map/array encoding configurable #163
Conversation
|
Yea this looks great! |
lib/ecto/adapters/sqlite3.ex
Outdated
| storage format. | ||
| * `:array_type` - Defaults to `:string`. Determines the type of `:array` columns. | ||
| Arrays are serialized using JSON. Set to `:binary` to use the | ||
| [JSONB](https://sqlite.org/draft/jsonb.html) storage format. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| [JSONB](https://sqlite.org/draft/jsonb.html) storage format. | |
| [JSONB](https://sqlite.org/jsonb.html) storage format. |
lib/ecto/adapters/sqlite3.ex
Outdated
| Possible values and column types are the same as for | ||
| [binary IDs](#module-binary-id-types). | ||
| * `:map_type` - Defaults to `:string`. Determines the type of `:map` columns. | ||
| Set to `:binary` to use the [JSONB](https://sqlite.org/draft/jsonb.html) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's point at the official docs and not the draft.
| Set to `:binary` to use the [JSONB](https://sqlite.org/draft/jsonb.html) | |
| Set to `:binary` to use the [JSONB](https://sqlite.org/jsonb.html) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops I missed that, fixed!
d21f7f4 to
ffeaeff
Compare
Closes #162
This PR adds:
:map_typeconfig option to determine how:mapcolumns are stored (:stringor:binary):array_typeconfig option for:arraycolumns (also:stringor:binary):arraycolumns are also serialized using JSONBoth default to
:string, the:binaryoption enables SQLite's JSONB storage format.I tried to be consistent with other configurable types in this project like
:uuidthat is why it is not implemented the exact same way as in the Postgres adapter.